import http from '@utils/http'

export const login = (userInfo) => { type: "LOGIN", userInfo };
export const logout = (userInfo) => { type: "LOGOUT", userInfo };

// 更新用户信息
export const updateUser = (userInfo) => {return { type: "UPDATE_INFO", data: userInfo }};

// 获取用户信息
export const getUser = () => {
    return (dispatch) => {
        http.get({
            url: '/api/data',
        }).then((data) => {
            dispatch(updateUser(data))
        })
    }
} 